package com.jlcindia.struts2;

import com.opensymphony.xwork2.validator.ValidationException;
import com.opensymphony.xwork2.validator.validators.FieldValidatorSupport;

public class MyEmailValidator extends FieldValidatorSupport {


	public void validate(Object object) throws ValidationException {
		String fieldName=getFieldName();
		String fieldValue=(String)getFieldValue(fieldName, object);
		if(fieldValue!=null||fieldValue.length()!=0){
			fieldName=fieldValue.trim();
			System.out.println(fieldValue);
			if(!fieldValue.endsWith("@jlc.com")){
				addFieldError(fieldName, object);
			}
		}

	}

}
